//
//  LzwHomeSingleton.h
//  NewHalfsugar
//
//  Created by 刘志武 on 16/1/14.
//  Copyright © 2016年 刘志武. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef void(^AFNBlock)(id resuposeObject);



typedef void(^AppToolsSuccessBolck)(NSData *resultData);
typedef void(^AppToolsFailBlock)(NSError *error);
typedef void(^AppToolsUrlBlock)(id result);



@interface LzwHomeSingleton : NSObject

/**
 *  AFN
 *
 *  @param url        请求地址url
 *  @param parameters body体
 *  @param cookie     cookie
 *  @param user_Agent user_Agent
 *  @param block      回调的block
 */
+ (void)creatingDataTask:(NSString *)url
              parameters:(NSDictionary *)parameters
                  Cookie:(NSString *)cookie
              User_Agent:(NSString *)user_Agent
         successAFNBlock:(AFNBlock)block;


/**
 *  用GET方法去请求数据
 *
 *  @param urlStr       请求地址url
 *  @param dicPara      参数列表
 *  @param successBlock 成功后回调的block
 *  @param failBlock    失败后回调的block
 */
+ (void)getDataFromNetUseGETMethodWithUrl:(NSString *)urlStr andParameters:(NSDictionary *)dicPara successBlock:(AppToolsSuccessBolck)successBlock failBlock:(AppToolsFailBlock)failBlock;


/**
 *  用POST方法去请求数据
 *
 *  @param urlStr       请求地址url
 *  @param dicPara      参数列表
 *  @param successBlock 成功后回调的block
 *  @param failBlock    失败后回调的block
 */
+ (void)getDataFromNetUsePOSTMethodWithUrl:(NSString *)urlStr andParameters:(NSDictionary *)dicPara successBlock:(AppToolsSuccessBolck)successBlock failBlock:(AppToolsFailBlock)failBlock;

+ (void)getDataFromUrls:(NSString *)urls block:(AppToolsUrlBlock)block;

//从本地请求数据
+ (NSString *)createFilePathFromDocumentWithFolders:(NSArray<NSString *> *)folders fileName:(NSString *)fileName;
//保存从本地请求下来的数据
+ (BOOL)saveDataOnLocal:(NSData *)data localPath:(NSString *)path;



@end
